package rkw.communication;

import java.net.BindException;
import java.util.HashMap;
import java.util.List;

import org.eclipse.swt.widgets.Shell;

import rkw.gui.DlgCommunicationState;
import core.communication.configurationNode.ConfigurationNode;
import core.communication.electionConfiguration.ElectionConfiguration;
import core.communication.message.ElectionCardMessage;
import core.communication.message.Message;
import core.communication.message.NodeStateEnum;
import core.communication.message.TerminalRegistrationMessage;
import core.communication.message.VerifyNonresidentVoterConfirmationMessage;
import core.communication.message.VoteMessage;
import core.database.ElectionStatus;

public interface CommunicationService {

	public void removeClientToCheck(Client client);

	public void sendNodeStateMessage(String locatorUri, NodeStateEnum state);

	public void reAddClientToCheck(Client client);

	public Client getClientToCheck();

	public void setUp() throws BindException;

	public void shutDown();

	public void send(Message message);

	public String getServerURI();

	public void addReceivedMessage(Message message);

	public Message getReceivedMessage();

	public void removeReceivedMessage(Message message);

	public void handleConfiguration(List<ConfigurationNode> configurationNodes);

	public void handleElectionConfiguration(Long electionIdentificationField, List<ElectionConfiguration> electionConfigurations);

	public String getPrefferedParentURI();

	public HashMap<String, Client> getUpperClients();
	
	public HashMap<String, Client> getTerminals();

	public void resendMessage(Message message);

	public void removeMessageToSend(Message message);

	public void addClientToCheck(Client client);

	public Message getMessageToSend();

	public void handleUpdateEntity(Message message);

	public void sendVerifyNonResidentVoter(Long electionIdentificationField, String voterIdentificationField, Shell responseShell);

	public void handleVoterVerificationConfirmation(VerifyNonresidentVoterConfirmationMessage message);

	public void handleTerminalRegistrationMessage(TerminalRegistrationMessage message);

	public void handleElectionCardMessage(ElectionCardMessage message);

	public void handleVoteMessage(VoteMessage message);

	public void sendElectionStatusMessage(Long electionId, ElectionStatus status);

	public boolean canConnect(String locatorUri);

	public void checkCommunication(DlgCommunicationState dlgCommunicationState);
}
